﻿using System.Windows.Controls;
using PSE.Deployment.SetupBase.Configuration;

namespace PSE.Deployment.ConfigurationManager.Controls
{
	/// <summary>
	/// UserControl que instancia um CheckBox com Binding na propriedade IsChecked
	/// </summary>
	public class SimpleCheckBox : CheckBox
	{
		private SimpleCheckBox()
		{
			this.SetResourceReference(SimpleCheckBox.TemplateProperty, "CheckBoxControlTemplateSetup");
			this.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
			this.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
		}

		public SimpleCheckBox(XmlTag tag) : this()
		{
			this.DataContext = tag;
			ConfigurationBinding bd = new ConfigurationBinding();
			this.SetBinding(SimpleCheckBox.IsCheckedProperty, bd);
		}

		public SimpleCheckBox(XmlAttribute attribute) : this()
		{
			this.DataContext = attribute;
			ConfigurationBinding bd = new ConfigurationBinding();
			this.SetBinding(SimpleCheckBox.IsCheckedProperty, bd);
		}

		public SimpleCheckBox(RegistryValue reg) : this()
		{
			this.DataContext = reg;
			ConfigurationBinding bd = new ConfigurationBinding();
			this.SetBinding(SimpleCheckBox.IsCheckedProperty, bd);
		}
	}
}